  Private Sub mnuOpen_Click(ByVal sender As Object, ByVal e As _
                 System.EventArgs) Handles mnuOpen.Click
    Dim FileName As String

    FileName = ""
    rtbOutput.Clear()
    With OpenFileDialog1
      .Filter = "Random files (*.dat)|*.dat|" & _
                "Text Files (*.txt)|*.txt|All " & _
                "Files (*.*)|*.*"
      .FilterIndex = 2
      .InitialDirectory = "C:\Temp\"
      .Title = "Select File"
    End With

    Try
      If OpenFileDialog1.ShowDialog() = DialogResult.OK Then 
        FileName = OpenFileDialog1.FileName
      Else
        Exit Sub     ' Nie chc kontynuowa...
      End If

      Select Case OpenFileDialog1.FilterIndex
        Case 1      ' O dostpie swobodnym
        Case 2      ' Tekst
          Dim MyReadText As StreamReader = New _
                        StreamReader(FileName)
          rtbOutput.Visible = True
          SizeRichTextbox()
          rtbOutput.Text = MyReadText.ReadToEnd()
          MyReadText.Close()
          MyReadText = Nothing
        Case Else
      End Select
    Catch
      MessageBox.Show("Somethings amiss...", "File Read Error")
    End Try
  End Sub
